import Book.BookList;
import User.*;

import java.util.Scanner;

public class Main {
    //向上转型
    public static User login(){
        System.out.println("name:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("1-admin 0-user");
        int choice = scanner.nextInt();
        if(choice == 1){
            return new Administrator(name);
        }else {
            return new NormalUser(name);
        }
    }

    public static void main(String[] args) {
        //准备书架
        BookList bookList = new BookList();

        //登录
        User user = login();

        //操作
        while(true) {
            int choice = user.menu();
            user.doOperate(choice, bookList);
        }

    }
}
